package com.wuhainan.beelzebub.controller.system;

import com.wuhainan.beelzebub.entity.system.Department;
import com.wuhainan.beelzebub.service.system.DepartmentService;
import com.wuhainan.beelzebub.utils.PageInfo;
import com.wuhainan.beelzebub.utils.TableData;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <br>Created by 吴海南 on 2017-12-18.
 * <br>星期一 at 上午 10:11.
 */
@RestController
@RequestMapping("api")
public class DepartmentController {
    @Resource
    private DepartmentService departmentService;
    @RequestMapping("departmentPage")
    public TableData DepartmentPage(PageInfo pageInfo, Department department){
        return departmentService.findDepartmentPage(pageInfo,department);
    }
    @RequestMapping("department/{id}")
    public Department department(@PathVariable String id) {
        return departmentService.findDepartmentById(id);
    }

    @RequestMapping("saveDepartment")
    public void saveDepartment(@RequestBody Department department) {
        departmentService.saveDepartment(department);
    }

    @RequestMapping("deleteDepartment")
    public void deleteDepartment(@RequestBody Department department) {
        departmentService.deleteDepartment(department);
    }

}
